<template>
  <div id="app">
      <button @click="createDialog('success')" class="success">Success</button>
      <button @click="createDialog('info')" class="info">Info</button>
      <button @click="createDialog('error')" class="error">Error</button>
      <button @click="createDialog('warning')" class="wraning">Wraning</button>
      <temp ref="temp" :query="query"></temp>
  </div>
</template>
<script>
    import Temp from './lib/Template'

    export default{
        data(){
           return {
               query: ''
           }
        },
        methods: {
           createDialog (type) {
              const msg = {
                  success :"这是来自success的消息",
                  info :"这是来自Info的消息",
                  error :"这是来自error的消息",
                  warning :"这是来自warning的消息"
              }
              this.query = msg[type]
              this.$refs.temp.add(this.query)
           }
        },
        components: {
            Temp
        }
    }
</script>>
<style lang="scss">
    #app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    margin-top: 60px;
    }

    h1, h2 {
    font-weight: normal;
    }

    ul {
    list-style-type: none;
    padding: 0;
    }

    li {
    display: inline-block;
    margin: 0 10px;
    }

    a {
    color: #42b983;
    }

    button {
      border: none;
      border-radius: 4px;
      padding: 5px 8px;
      cursor: pointer;
      outline: none;
      color: #fff;
      transition: all 0.2s;

      &.success {
          background-color: #61b26c;
           border: 1px solid #61b26c;
          
          &:hover{
              background-color: #fff;
              color: #61b26c;
              border: 1px solid #61b26c;
          }
      }
      &.info {
          background-color: #a085bb;
          border: 1px solid #a085bb;
          &:hover{
              background-color: #fff;
              color: #a085bb;
              border: 1px solid #a085bb;
          }
      }
      &.error {
          background-color: #f16464;
          border: 1px solid #f16464;
          &:hover{
              background-color: #fff;
              color: #f16464;
              border: 1px solid #f16464;
          }
      }
      &.wraning {
          background-color: #f89e35;
            border: 1px solid #f89e35;
          &:hover{
              background-color: #fff;
              color: #f89e35;
              border: 1px solid #f89e35;
          }
      }
    }
  
</style>
